<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    function getQueryObject(url){
      url = url == null ? window.location.href : url;
      var search = url.substring(url.lastIndexOf("?")+1)
      var obj = {};
      var reg = /([^?&=]+)=([^?&=]*)/g;
      search.replace(reg,function(rs,a,b) {
        var name = decodeURIComponent(a);
        var val = decodeURIComponent(b);
        val = String(val);
        obj[name] = val;
        return rs;
      })
      return obj
    }
    let o = getQueryObject( "http://www.cnblogs.com/leee/p/4456840.html?name=1&dd=ddd**&a=b" )
    console.log(o);
  </script>
</body>
</html>